import lombok.SneakyThrows;

public class MyThread implements Runnable {
  public volatile Boolean running = true;
  public volatile Boolean pasused = false;
  public final Object lock = new Object();
  public void resumeThread() {
    this.pasused = false;
    synchronized (lock) {
      lock.notify();
    }
  }
  @SneakyThrows
  @Override
  public void run() {
    while (running) {
      if (pasused) synchronized (lock) {
        lock.wait();
      }
      System.out.println("running");
      Thread.sleep(1000);
    }
  }
}
